<?php
/* This file is part of Mirasol CMS
   (C) 2011 by Alban Technologies. Written by Chris Alban Hansen.
   Released under the terms of the GNU General Public License.
   See COPYING in the top level directory of the Mirasol CMS installation. */

include "{$_SERVER['DOCUMENT_ROOT']}/includes/config.php";

if ($loadsubpage == 1)
{
  $result = mysql_query ("SELECT * FROM ".db_maketablename ($table_settings)." LIMIT 1");
  if (mysql_num_rows ($result) > 0)
    {
      $row = mysql_fetch_array ($result);
      
      $id = $row['id'];
      $sitename = htmlentities ($row['sitename'], ENT_COMPAT, "UTF-8", false);
      $domainname = htmlentities ($row['domainname'], ENT_COMPAT, "UTF-8", false);
      $protocol = $row['protocol'];
    }
  mysql_free_result ($result);
?>
<h1>Settings</h1>

<form method="post" action="../includes/savesettings.php">
  <table cellpadding="0" cellspacing="0" class="form">
    <tr>
      <td class="form"><strong>Site name:</strong></td>
      <td class="formfield"><input type="text" name="sitename" value="<?=$sitename ?>" maxlength="100" class="textfield" style="width: 300px;" /></td>
    </tr>
    <tr>
      <td class="form"><strong>Domain name:</strong></td>
      <td class="formfield">
        <select name="protocol">
          <option value="http"<?=$protocol == "http" ? " selected=\"selected\"" : ""?>>http://</option>
          <option value="https"<?=$protocol == "https" ? " selected=\"selected\"" : ""?>>https://</option>
        </select>
        <input type="text" name="domainname" value="<?=$domainname ?>" maxlength="255" class="textfield" style="width: 300px;" />
      </td>
    </tr>
    <tr>
      <td colspan="2">
        <input type="hidden" name="id" value="<?=$id ?>" />
        <input type="submit" value="Save" class="button alignright" />
      </td>
    </tr>
  </table>
</form>
<?php
}
?>
